package com.jungle.mvvm.sample.ui.toolbar;

import android.databinding.ObservableField;
import android.databinding.ObservableInt;
import android.graphics.drawable.Drawable;
import android.support.annotation.NonNull;
import android.view.View;

import com.jungle.mvvm.base.BaseViewModel;
import com.jungle.mvvm.base.ItemViewModel;
import com.jungle.mvvm.binding.command.BindingCommand;

/**
 * @ClassName ToolBarViewModel
 * @Description ToolBarViewModel
 * @Author Daniel
 * @Version V1.0.0
 */
public class ToolBarViewModel extends ItemViewModel {
    // 标题
    public ObservableField<String> title = new ObservableField<>();
    public ObservableInt leftVisible = new ObservableInt(View.VISIBLE);
    // 右侧按钮默认不显示
    public ObservableInt rightVisible = new ObservableInt(View.GONE);
    // 右侧图标
    public ObservableField<Drawable> rightImg = new ObservableField<Drawable>();

    /**
     * 构造
     *
     * @param viewModel
     */
    public ToolBarViewModel(@NonNull BaseViewModel viewModel) {
        super(viewModel);
    }


    /**
     * 返回
     */
    public BindingCommand backClick = new BindingCommand(() -> viewModel.finish());

    /**
     * 右侧按钮
     */
    public BindingCommand rightClick = new BindingCommand(() -> {
    });

    public BindingCommand getRightClick() {
        return rightClick;
    }

    public void setRightClick(BindingCommand rightClick) {
        this.rightClick = rightClick;
    }
}
